package org.example.aop.aspect;


import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;


@Order(13)
@Slf4j
@Component
@Aspect
public class AspectDemo2 {

    //减少切点的⼤量重复
    @Pointcut("execution(* org.example.aop.controller.*.*(..))")
    public void pt(){}

    @Around("pt()")
    //建议不要使用void，使用void可能会出现显示结果的情况
    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
        log.info("AspectDemo2 before around...");
        Object object =  joinPoint.proceed();
        log.info("AspectDemo2 after before...");
        return object;
    }

    @Before("pt()")
    public void before(){
        log.info("AspectDemo2 before ...");
    }

}
